#!/bin/bash

set -e

PYTHON_DIRS=("neotest_python")

if [[ $1 == "-w" ]]; then
  black "${PYTHON_DIRS[@]}"
  isort "${PYTHON_DIRS[@]}"
  autoflake --remove-unused-variables --remove-all-unused-imports --ignore-init-module-imports --remove-duplicate-keys --recursive -i "${PYTHON_DIRS[@]}"
  stylua lua
else
  black --check "${PYTHON_DIRS[@]}"
  isort --check "${PYTHON_DIRS[@]}"
  autoflake --remove-unused-variables --remove-all-unused-imports --ignore-init-module-imports --remove-duplicate-keys --recursive "${PYTHON_DIRS[@]}"
fi
